package com.pagepub.core.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 信息容器
 * @author ggd
 *
 */
public class ActionMessages
{
	private Map<String,ActionMessage> msglist=new HashMap<String,ActionMessage>();
	public ActionMessages()
	{
	}
	/**
	 * 添加消息
	 * @param messageFieldName key对应的fm
	 * @param fm　错误消息
	 */
	public void addActionMessage(String messageFieldName,ActionMessage fm)
	{
		ActionMessage f=msglist.get(messageFieldName);
		if(f!=null)
		{
			f.addMessage(fm.getMessages().replaceAll("\n",""));
		}
		else
		{
			f=fm;
		}
		msglist.put(messageFieldName,f);
	}
	public void clearMessage()
	{
		msglist.clear();
	}
	/**
	 * 取得消息列表　
	 * @return
	 */
	public Map<String, ActionMessage> getMsglist()
	{
		return msglist;
	}
}

